package com.ibt.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;





@Entity 
@Table(name = "module")
public class Module implements Serializable {
	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	@Column(name="id")
	int id;
	
	@ManyToOne
	@JoinColumn(name="BUSINESS_ID")
	Business businessId;
	
	@ManyToOne
	@JoinColumn(name="PROJECT_ID")
	ProjectEntry projectId;
	
	@Column(name="moduledesc")
	String moduleDesc;
	@Column(name="modulename")
	String moduleName;
	
	@Column(name="project_name")
	String ProjectName;
	  
	@OneToMany(cascade = CascadeType.ALL)
	@JoinColumn(name = "module_id", referencedColumnName = "id")
	private Set<BuildIds> buildIds = new HashSet<BuildIds>();
	
	public Module(){}
	public Module(int id, ProjectEntry projectId, Business businessId, String moduleName,
			String moduleDesc) {
		super();
		this.id = id;
		this.projectId = projectId;
		this.businessId = businessId;
		this.moduleDesc = moduleDesc;
		this.moduleName = moduleName;
		
	}
	public Module(ProjectEntry projectId, Business businessId,
			String moduleDesc, String moduleName) {
		super();
		this.projectId = projectId;
		this.businessId = businessId;
		this.moduleDesc = moduleDesc;
		this.moduleName = moduleName;
	}
	
	public Module(ProjectEntry pEntry, Business bus, String module,
			String desc, String pname) {
		super();
		this.projectId = pEntry;
		this.businessId = bus;
		this.moduleDesc = desc;
		this.moduleName = module;
		this.ProjectName=pname;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public ProjectEntry getProjectId() {
		return projectId;
	}
	public void setProjectId(ProjectEntry projectId) {
		this.projectId = projectId;
	}
	public Business getBusinessId() {
		return businessId;
	}
	public void setBusinessId(Business businessId) {
		this.businessId = businessId;
	}
	public String getModuleDesc() {
		return moduleDesc;
	}
	public void setModuleDesc(String moduleDesc) {
		this.moduleDesc = moduleDesc;
	}
	public String getModuleName() {
		return moduleName;
	}
	public void setModuleName(String moduleName) {
		this.moduleName = moduleName;
	}
	public Set<BuildIds> getBuildIds() {
		return buildIds;
	}
	public void setBuildIds(Set<BuildIds> buildIds) {
		this.buildIds = buildIds;
	}
	public String getProjectName() {
		return ProjectName;
	}
	public void setProjectName(String projectName) {
		ProjectName = projectName;
	}
	

}
